# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-05-24
# @File : 4.1_hook_buriedExpLabel.py

import frida
import sys

rdev = frida.get_remote_device()
session = rdev.attach("京东")

scr = """
Java.perform(function () {

    var JDBModeDataHelper = Java.use("com.jingdong.sdk.bmode.util.JDBModeDataHelper");
    JDBModeDataHelper.handleMtaData.implementation = function(bModeSlimUserData){
        //console.log("=================");
        console.log("bModeSlimUserData=",bModeSlimUserData);
        var buriedExpLabel = bModeSlimUserData.getBuriedExpLabel();
        console.log("buriedExpLabel=",buriedExpLabel);
        
        var jDBModeManager = this.JDBModeManager.INSTANCE;
        console.log("jDBModeManager=",jDBModeManager);
        console.log("jDBModeManager_CACHE_KEY_MODE_POPULATION_TYPE=",JDBModeManager.CACHE_KEY_MODE_POPULATION_TYPE);
        
        var iElderModeHelper2 = this.helper
        console.log("jDBModeManager=",jDBModeManager);



        //console.log("=================");
        var res = this.handleMtaData(bModeSlimUserData)
        return res;
    }
});
"""
script = session.create_script(scr)


def on_message(message, data):
    print(message, data)


script.on("message", on_message)
script.load()
sys.stdin.read()